package com.lanou3g.code0418.methods;

/**
 * If there are no bugs, it was created by Chen FengYao on 2018/4/18;
 * Otherwise, I don't know who created it either
 */

public class Main {
    public static void main(String[] args) {
        //currentThread()可以返回当前方法所在的线程对象
        Thread thread = Thread.currentThread();

        try {
            // 让线程 沉睡多少毫秒,该方法会抛出一个异常
            // 需要try-catch
            // 并且 线程在沉睡的时候 不会释放锁
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        ThreadUtil.sleep(1000);

        // 获取线程名字
        System.out.println(thread.getName());


    }
}
